<div ng-controller="DriverDetailController as vm">
  <h1 class="page-title">查看司机</h1>
  <div class="btn-toolbar" ng-show="vm.loadDone&&vm.userRole!='shipper'">
    <button ng-show="vm.userRole=='admin' && vm.driver.approvalStatus!=2" class="btn btn-primary" ng-click="vm.verify(true)"><i class="icon-ok"></i> 审核通过</button>
    <button ng-show="vm.userRole=='admin' && vm.driver.approvalStatus!=2" class="btn btn-danger" ng-click="vm.verify(false)"><i class="icon-remove"></i> 审核不通过</button>
    <button class="btn btn-inverse" ng-show="vm.userRole=='admin' && vm.driver.valid" ng-click="vm.addBlack(vm.driver.id)"><i class="icon-ban-circle"></i> 加入黑名单</button>
    <button class="btn btn-inverse" ng-show="vm.userRole=='admin' && !vm.driver.valid" ng-click="vm.cancelBlack(vm.driver.id)"><i class="icon-ban-circle"></i>取消黑名单</button>
      <div class="btn-group">
      <button ng-show="(vm.driver.approvalStatus<2 ||vm.driver.approvalStatus==3 || vm.userRole=='admin') && vm.userRole!='revenuer'" class="btn btn-primary" ng-click="vm.enableEdit()">修改资料</button>
    </div>
    <button class="btn btn-inverse" ng-show="vm.userRole=='admin' || vm.userRole=='carrier'" ng-click="deleteMe(vm.driver.id)"><i class="icon-ban-circle"></i>删除</button>
  </div>
  <div class="well" >
    <form class="form-horizontal" ng-submit="vm.processForm()">
      <fieldset>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">姓名</label>
          <div class="controls">
            <input type="text" ng-readonly="!vm.editing" class="input-xlarge" ng-model="vm.driver.name">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">手机号</label>
          <div class="controls">
            <input type="text" ng-readonly="!vm.editing" class="input-xlarge" ng-model="vm.driver.phoneNumber">
            <p class="help-block"></p>
          </div>
        </div>
        
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">身份证</label>
          <div class="controls">
            <input type="text" ng-readonly="!vm.editing" class="input-xlarge" ng-model="vm.driver.idNumber">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">驾驶证初次时间</label>
          <div class="controls">
            <input type="text" readonly ng-show="!vm.editing" class="input-xlarge" ng-model="vm.driver.firstLicenseDate">
            <input type="text" ng-show="vm.editing" class="input-xlarge datepicker" ng-model="vm.driver.firstLicenseDate">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">驾驶证有效期</label>
          <div class="controls">
            <input type="text" readonly ng-show="!vm.editing" class="input-xlarge" ng-model="vm.driver.licenseValidTo">
            <input type="text" ng-show="vm.editing" class="input-xlarge datepicker" ng-model="vm.driver.licenseValidTo">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">备用1</label>
          <div class="controls">
            <input type="text" ng-readonly="!vm.editing" class="input-xlarge" ng-model="vm.driver.reserved1">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">备用2</label>
          <div class="controls">
            <input type="text" ng-readonly="!vm.editing" class="input-xlarge" ng-model="vm.driver.reserved2">
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group" ng-show="vm.editing">
          <label class="control-label" >上传驾驶证照片</label>
          <!-- File Upload -->
          <div class="controls">
              <input type="text" id="jia" placeholder="" class="input-large" style="display: none"/>
              <image id="jiaImg" style="display: none;" width="30" height="40"></image>
              <a style="cursor: hand" onclick="openUpload('jia')">上传文件</a>
          </div>
        </div>
        <div class="control-group" ng-show="vm.editing">
          <label class="control-label" >上传身份证照片</label>
          <!-- File Upload -->
          <div class="controls">
              <input type="text" id="shen" placeholder="" class="input-large" style="display: none"/>
              <image id="shenImg" style="display: none;" width="30" height="40"></image>
              <a style="cursor: hand" onclick="openUpload('shen')">上传文件</a>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label"></label>
          <!-- Button -->
          <div class="controls">
            <button class="btn btn-primary" ng-disabled="uploadid" ng-show="vm.editing && vm.driver.approvalStatus!=2">保存并提交审核</button>
            <button class="btn btn-primary" ng-disabled="uploadid" ng-show="vm.editing && vm.driver.approvalStatus==2">保存</button>
          </div>
        </div>
        
        
      </fieldset>
      <fieldset>
        <div id="legend" class="">
          <legend class="">已上传的资料</legend>
        </div>
        <div class="control-group" ng-show="vm.driver.idNumberAttachment">
          <!-- Text input-->
          <label class="control-label" >身份证资料</label>
          <div class="controls">
            <a target="_blank" ng-href="/api/{{vm.driver.idNumberAttachment}}">查看附件</a>
            <p class="help-block"></p>
          </div>
        </div>
        <div class="control-group" ng-show="vm.driver.firstLicenseDateAttachment">
          <!-- Text input-->
          <label class="control-label" >驾驶证资料</label>
          <div class="controls">
            <a target="_blank" ng-href="/api/{{vm.driver.firstLicenseDateAttachment}}" >查看附件</a>
            <p class="help-block"></p>
          </div>
        </div>
      </fieldset>
    </form>
      <script>
          function openUpload(inputid){
              var url = "../views/upload.html?id="+ inputid;
              var iWidth=400; //弹出窗口的宽度;
              var iHeight=300; //弹出窗口的高度;
              var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
              var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
              window.open(url,'uploadwindow','height='+iHeight+',width='+iWidth+',top='+iTop+',left='+ iLeft +',toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
          }
      </script>
  </div>
</div>
